AC_PREREQ([2.69])
AC_INIT([prayer],[1.0],[mohammad.nabil.h@gmail.com])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wall])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])

# Checks for libraries.
have_itl=no
LDFLAGS="$LDFLAGS -L/usr/lib/itl -Wl,-rpath,/usr/lib/itl"
AC_SEARCH_LIBS([getPrayerTimes], [itl], [have_itl=yes])

# Checks for header files.
AC_CHECK_HEADERS([getopt.h time.h])	

if test "x${have_itl}" = xyes; then
      AC_CHECK_HEADERS([itl/prayer.h], [], [have_itl=no])
fi

if test "x${have_itl}" = xno; then
   AC_MSG_ERROR([
  ----------------------------------------
   The itl library and header file
   required to build prayer. Stopping...
   Check config.log for more information.
  ----------------------------------------])
fi

AC_CONFIG_FILES([
        Makefile
        src/Makefile
])
AC_OUTPUT
